//===----------------------------------------------------------------------===//
//
// This source file is part of the Soto for AWS open source project
//
// Copyright (c) 2017-2022 the Soto project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
// See CONTRIBUTORS.txt for the list of Soto project authors
//
// SPDX-License-Identifier: Apache-2.0
//
//===----------------------------------------------------------------------===//

// THIS FILE IS AUTOMATICALLY GENERATED by https://github.com/soto-project/soto-codegenerator.
// DO NOT EDIT.

#if compiler(>=5.5.2) && canImport(_Concurrency)

import SotoCore

@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
extension ManagedBlockchain {
    // MARK: Async API Calls

    ///  The token based access feature is in preview release for Ethereum on Amazon Managed Blockchain and is  subject to change. We recommend that you use this feature only with  test scenarios, and not in production environments.  Creates a new accessor for use with Managed Blockchain Ethereum nodes. An accessor object is a container that has the information  required for token based access to your Ethereum nodes.
    public func createAccessor(_ input: CreateAccessorInput, logger: Logger = AWSClient.loggingDisabled, on eventLoop: EventLoop? = nil) async throws -> CreateAccessorOutput {
        return try await self.client.execute(operation: "CreateAccessor", path: "/accessors", httpMethod: .POST, serviceConfig: self.config, input: input, logger: logger, on: eventLoop)
    }

    /// Creates a member within a Managed Blockchain network. Applies only to Hyperledger Fabric.
    public func createMember(_ input: CreateMemberInput, logger: Logger = AWSClient.loggingDisabled, on eventLoop: EventLoop? = nil) async throws -> CreateMemberOutput {
        return try await self.client.execute(operation: "CreateMember", path: "/networks/{NetworkId}/members", httpMethod: .POST, serviceConfig: self.config, input: input, logger: logger, on: eventLoop)
    }

    /// Creates a new blockchain network using Amazon Managed Blockchain. Applies only to Hyperledger Fabric.
    public func createNetwork(_ input: CreateNetworkInput, logger: Logger = AWSClient.loggingDisabled, on eventLoop: EventLoop? = nil) async throws -> CreateNetworkOutput {
        return try await self.client.execute(operation: "CreateNetwork", path: "/networks", httpMethod: .POST, serviceConfig: self.config, input: input, logger: logger, on: eventLoop)
    }

    /// Creates a node on the specified blockchain network. Applies to Hyperledger Fabric and Ethereum.
    public func createNode(_ input: CreateNodeInput, logger: Logger = AWSClient.loggingDisabled, on eventLoop: EventLoop? = nil) async throws -> CreateNodeOutput {
        return try await self.client.execute(operation: "CreateNode", path: "/networks/{NetworkId}/nodes", httpMethod: .POST, serviceConfig: self.config, input: input, logger: logger, on: eventLoop)
    }

    /// Creates a proposal for a change to the network that other members of the network can vote on, for example, a proposal to add a new member to the network. Any member can create a proposal. Applies only to Hyperledger Fabric.
    public func createProposal(_ input: CreateProposalInput, logger: Logger = AWSClient.loggingDisabled, on eventLoop: EventLoop? = nil) async throws -> CreateProposalOutput {
        return try await self.client.execute(operation: "CreateProposal", path: "/networks/{NetworkId}/proposals", httpMethod: .POST, serviceConfig: self.config, input: input, logger: logger, on: eventLoop)
    }

    ///  The token based access feature is in preview release for Ethereum on Amazon Managed Blockchain and is  subject to change. We recommend that you use this feature only with  test scenarios, and not in production environments.  Deletes an accessor that your Amazon Web Services account owns. An accessor object is a container that has the  information required for token based access to your Ethereum nodes including, the  BILLING_TOKEN. After an accessor is deleted, the status of the accessor changes  from AVAILABLE to PENDING_DELETION. An accessor in the  PENDING_DELETION state can’t be used for new WebSocket requests or  HTTP requests. However, WebSocket connections that were initiated while the accessor was in the  AVAILABLE state remain open until they expire (up to 2 hours).
    public func deleteAccessor(_ input: DeleteAccessorInput, logger: Logger = AWSClient.loggingDisabled, on eventLoop: EventLoop? = nil) async throws -> DeleteAccessorOutput {
        return try await self.client.execute(operation: "DeleteAccessor", path: "/accessors/{AccessorId}", httpMethod: .DELETE, serviceConfig: self.config, input: input, logger: logger, on: eventLoop)
    }

    /// Deletes a member. Deleting a member removes the member and all associated resources from the network. DeleteMember can only be called for a specified MemberId if the principal performing the action is associated with the Amazon Web Services account that owns the member. In all other cases, the DeleteMember action is carried out as the result of an approved proposal to remove a member. If MemberId is the last member in a network specified by the last Amazon Web Services account, the network is deleted also. Applies only to Hyperledger Fabric.
    public func deleteMember(_ input: DeleteMemberInput, logger: Logger = AWSClient.loggingDisabled, on eventLoop: EventLoop? = nil) async throws -> DeleteMemberOutput {
        return try await self.client.execute(operation: "DeleteMember", path: "/networks/{NetworkId}/members/{MemberId}", httpMethod: .DELETE, serviceConfig: self.config, input: input, logger: logger, on: eventLoop)
    }

    /// Deletes a node that your Amazon Web Services account owns. All data on the node is lost and cannot be recovered. Applies to Hyperledger Fabric and Ethereum.
    public func deleteNode(_ input: DeleteNodeInput, logger: Logger = AWSClient.loggingDisabled, on eventLoop: EventLoop? = nil) async throws -> DeleteNodeOutput {
        return try await self.client.execute(operation: "DeleteNode", path: "/networks/{NetworkId}/nodes/{NodeId}", httpMethod: .DELETE, serviceConfig: self.config, input: input, logger: logger, on: eventLoop)
    }

    ///  The token based access feature is in preview release for Ethereum on Amazon Managed Blockchain and is  subject to change. We recommend that you use this feature only with  test scenarios, and not in production environments.  Returns detailed information about an accessor. An accessor object is a container that has the  information required for token based access to your Ethereum nodes.
    public func getAccessor(_ input: GetAccessorInput, logger: Logger = AWSClient.loggingDisabled, on eventLoop: EventLoop? = nil) async throws -> GetAccessorOutput {
        return try await self.client.execute(operation: "GetAccessor", path: "/accessors/{AccessorId}", httpMethod: .GET, serviceConfig: self.config, input: input, logger: logger, on: eventLoop)
    }

    /// Returns detailed information about a member. Applies only to Hyperledger Fabric.
    public func getMember(_ input: GetMemberInput, logger: Logger = AWSClient.loggingDisabled, on eventLoop: EventLoop? = nil) async throws -> GetMemberOutput {
        return try await self.client.execute(operation: "GetMember", path: "/networks/{NetworkId}/members/{MemberId}", httpMethod: .GET, serviceConfig: self.config, input: input, logger: logger, on: eventLoop)
    }

    /// Returns detailed information about a network. Applies to Hyperledger Fabric and Ethereum.
    public func getNetwork(_ input: GetNetworkInput, logger: Logger = AWSClient.loggingDisabled, on eventLoop: EventLoop? = nil) async throws -> GetNetworkOutput {
        return try await self.client.execute(operation: "GetNetwork", path: "/networks/{NetworkId}", httpMethod: .GET, serviceConfig: self.config, input: input, logger: logger, on: eventLoop)
    }

    /// Returns detailed information about a node. Applies to Hyperledger Fabric and Ethereum.
    public func getNode(_ input: GetNodeInput, logger: Logger = AWSClient.loggingDisabled, on eventLoop: EventLoop? = nil) async throws -> GetNodeOutput {
        return try await self.client.execute(operation: "GetNode", path: "/networks/{NetworkId}/nodes/{NodeId}", httpMethod: .GET, serviceConfig: self.config, input: input, logger: logger, on: eventLoop)
    }

    /// Returns detailed information about a proposal. Applies only to Hyperledger Fabric.
    public func getProposal(_ input: GetProposalInput, logger: Logger = AWSClient.loggingDisabled, on eventLoop: EventLoop? = nil) async throws -> GetProposalOutput {
        return try await self.client.execute(operation: "GetProposal", path: "/networks/{NetworkId}/proposals/{ProposalId}", httpMethod: .GET, serviceConfig: self.config, input: input, logger: logger, on: eventLoop)
    }

    ///  The token based access feature is in preview release for Ethereum on Amazon Managed Blockchain and is  subject to change. We recommend that you use this feature only with  test scenarios, and not in production environments.  Returns a list of the accessors and their properties. Accessor objects are containers that have the  information required for token based access to your Ethereum nodes.
    public func listAccessors(_ input: ListAccessorsInput, logger: Logger = AWSClient.loggingDisabled, on eventLoop: EventLoop? = nil) async throws -> ListAccessorsOutput {
        return try await self.client.execute(operation: "ListAccessors", path: "/accessors", httpMethod: .GET, serviceConfig: self.config, input: input, logger: logger, on: eventLoop)
    }

    /// Returns a list of all invitations for the current Amazon Web Services account. Applies only to Hyperledger Fabric.
    public func listInvitations(_ input: ListInvitationsInput, logger: Logger = AWSClient.loggingDisabled, on eventLoop: EventLoop? = nil) async throws -> ListInvitationsOutput {
        return try await self.client.execute(operation: "ListInvitations", path: "/invitations", httpMethod: .GET, serviceConfig: self.config, input: input, logger: logger, on: eventLoop)
    }

    /// Returns a list of the members in a network and properties of their configurations. Applies only to Hyperledger Fabric.
    public func listMembers(_ input: ListMembersInput, logger: Logger = AWSClient.loggingDisabled, on eventLoop: EventLoop? = nil) async throws -> ListMembersOutput {
        return try await self.client.execute(operation: "ListMembers", path: "/networks/{NetworkId}/members", httpMethod: .GET, serviceConfig: self.config, input: input, logger: logger, on: eventLoop)
    }

    /// Returns information about the networks in which the current Amazon Web Services account participates. Applies to Hyperledger Fabric and Ethereum.
    public func listNetworks(_ input: ListNetworksInput, logger: Logger = AWSClient.loggingDisabled, on eventLoop: EventLoop? = nil) async throws -> ListNetworksOutput {
        return try await self.client.execute(operation: "ListNetworks", path: "/networks", httpMethod: .GET, serviceConfig: self.config, input: input, logger: logger, on: eventLoop)
    }

    /// Returns information about the nodes within a network. Applies to Hyperledger Fabric and Ethereum.
    public func listNodes(_ input: ListNodesInput, logger: Logger = AWSClient.loggingDisabled, on eventLoop: EventLoop? = nil) async throws -> ListNodesOutput {
        return try await self.client.execute(operation: "ListNodes", path: "/networks/{NetworkId}/nodes", httpMethod: .GET, serviceConfig: self.config, input: input, logger: logger, on: eventLoop)
    }

    /// Returns the list of votes for a specified proposal, including the value of each vote and the unique identifier of the member that cast the vote. Applies only to Hyperledger Fabric.
    public func listProposalVotes(_ input: ListProposalVotesInput, logger: Logger = AWSClient.loggingDisabled, on eventLoop: EventLoop? = nil) async throws -> ListProposalVotesOutput {
        return try await self.client.execute(operation: "ListProposalVotes", path: "/networks/{NetworkId}/proposals/{ProposalId}/votes", httpMethod: .GET, serviceConfig: self.config, input: input, logger: logger, on: eventLoop)
    }

    /// Returns a list of proposals for the network. Applies only to Hyperledger Fabric.
    public func listProposals(_ input: ListProposalsInput, logger: Logger = AWSClient.loggingDisabled, on eventLoop: EventLoop? = nil) async throws -> ListProposalsOutput {
        return try await self.client.execute(operation: "ListProposals", path: "/networks/{NetworkId}/proposals", httpMethod: .GET, serviceConfig: self.config, input: input, logger: logger, on: eventLoop)
    }

    /// Returns a list of tags for the specified resource. Each tag consists of a key and optional value. For more information about tags, see Tagging Resources in the Amazon Managed Blockchain Ethereum Developer Guide, or Tagging Resources in the Amazon Managed Blockchain Hyperledger Fabric Developer Guide.
    public func listTagsForResource(_ input: ListTagsForResourceRequest, logger: Logger = AWSClient.loggingDisabled, on eventLoop: EventLoop? = nil) async throws -> ListTagsForResourceResponse {
        return try await self.client.execute(operation: "ListTagsForResource", path: "/tags/{ResourceArn}", httpMethod: .GET, serviceConfig: self.config, input: input, logger: logger, on: eventLoop)
    }

    /// Rejects an invitation to join a network. This action can be called by a principal in an Amazon Web Services account that has received an invitation to create a member and join a network. Applies only to Hyperledger Fabric.
    public func rejectInvitation(_ input: RejectInvitationInput, logger: Logger = AWSClient.loggingDisabled, on eventLoop: EventLoop? = nil) async throws -> RejectInvitationOutput {
        return try await self.client.execute(operation: "RejectInvitation", path: "/invitations/{InvitationId}", httpMethod: .DELETE, serviceConfig: self.config, input: input, logger: logger, on: eventLoop)
    }

    /// Adds or overwrites the specified tags for the specified Amazon Managed Blockchain resource. Each tag consists of a key and optional value. When you specify a tag key that already exists, the tag value is overwritten with the new value. Use UntagResource to remove tag keys. A resource can have up to 50 tags. If you try to create more than 50 tags for a resource, your request fails and returns an error. For more information about tags, see Tagging Resources in the Amazon Managed Blockchain Ethereum Developer Guide, or Tagging Resources in the Amazon Managed Blockchain Hyperledger Fabric Developer Guide.
    public func tagResource(_ input: TagResourceRequest, logger: Logger = AWSClient.loggingDisabled, on eventLoop: EventLoop? = nil) async throws -> TagResourceResponse {
        return try await self.client.execute(operation: "TagResource", path: "/tags/{ResourceArn}", httpMethod: .POST, serviceConfig: self.config, input: input, logger: logger, on: eventLoop)
    }

    /// Removes the specified tags from the Amazon Managed Blockchain resource. For more information about tags, see Tagging Resources in the Amazon Managed Blockchain Ethereum Developer Guide, or Tagging Resources in the Amazon Managed Blockchain Hyperledger Fabric Developer Guide.
    public func untagResource(_ input: UntagResourceRequest, logger: Logger = AWSClient.loggingDisabled, on eventLoop: EventLoop? = nil) async throws -> UntagResourceResponse {
        return try await self.client.execute(operation: "UntagResource", path: "/tags/{ResourceArn}", httpMethod: .DELETE, serviceConfig: self.config, input: input, logger: logger, on: eventLoop)
    }

    /// Updates a member configuration with new parameters. Applies only to Hyperledger Fabric.
    public func updateMember(_ input: UpdateMemberInput, logger: Logger = AWSClient.loggingDisabled, on eventLoop: EventLoop? = nil) async throws -> UpdateMemberOutput {
        return try await self.client.execute(operation: "UpdateMember", path: "/networks/{NetworkId}/members/{MemberId}", httpMethod: .PATCH, serviceConfig: self.config, input: input, logger: logger, on: eventLoop)
    }

    /// Updates a node configuration with new parameters. Applies only to Hyperledger Fabric.
    public func updateNode(_ input: UpdateNodeInput, logger: Logger = AWSClient.loggingDisabled, on eventLoop: EventLoop? = nil) async throws -> UpdateNodeOutput {
        return try await self.client.execute(operation: "UpdateNode", path: "/networks/{NetworkId}/nodes/{NodeId}", httpMethod: .PATCH, serviceConfig: self.config, input: input, logger: logger, on: eventLoop)
    }

    /// Casts a vote for a specified ProposalId on behalf of a member. The member to vote as, specified by VoterMemberId, must be in the same Amazon Web Services account as the principal that calls the action. Applies only to Hyperledger Fabric.
    public func voteOnProposal(_ input: VoteOnProposalInput, logger: Logger = AWSClient.loggingDisabled, on eventLoop: EventLoop? = nil) async throws -> VoteOnProposalOutput {
        return try await self.client.execute(operation: "VoteOnProposal", path: "/networks/{NetworkId}/proposals/{ProposalId}/votes", httpMethod: .POST, serviceConfig: self.config, input: input, logger: logger, on: eventLoop)
    }
}

// MARK: Paginators

@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
extension ManagedBlockchain {
    ///   The token based access feature is in preview release for Ethereum on Amazon Managed Blockchain and is  subject to change. We recommend that you use this feature only with  test scenarios, and not in production environments.  Returns a list of the accessors and their properties. Accessor objects are containers that have the  information required for token based access to your Ethereum nodes.
    /// Return PaginatorSequence for operation.
    ///
    /// - Parameters:
    ///   - input: Input for request
    ///   - logger: Logger used flot logging
    ///   - eventLoop: EventLoop to run this process on
    public func listAccessorsPaginator(
        _ input: ListAccessorsInput,
        logger: Logger = AWSClient.loggingDisabled,
        on eventLoop: EventLoop? = nil
    ) -> AWSClient.PaginatorSequence<ListAccessorsInput, ListAccessorsOutput> {
        return .init(
            input: input,
            command: self.listAccessors,
            inputKey: \ListAccessorsInput.nextToken,
            outputKey: \ListAccessorsOutput.nextToken,
            logger: logger,
            on: eventLoop
        )
    }

    ///  Returns a list of all invitations for the current Amazon Web Services account. Applies only to Hyperledger Fabric.
    /// Return PaginatorSequence for operation.
    ///
    /// - Parameters:
    ///   - input: Input for request
    ///   - logger: Logger used flot logging
    ///   - eventLoop: EventLoop to run this process on
    public func listInvitationsPaginator(
        _ input: ListInvitationsInput,
        logger: Logger = AWSClient.loggingDisabled,
        on eventLoop: EventLoop? = nil
    ) -> AWSClient.PaginatorSequence<ListInvitationsInput, ListInvitationsOutput> {
        return .init(
            input: input,
            command: self.listInvitations,
            inputKey: \ListInvitationsInput.nextToken,
            outputKey: \ListInvitationsOutput.nextToken,
            logger: logger,
            on: eventLoop
        )
    }

    ///  Returns a list of the members in a network and properties of their configurations. Applies only to Hyperledger Fabric.
    /// Return PaginatorSequence for operation.
    ///
    /// - Parameters:
    ///   - input: Input for request
    ///   - logger: Logger used flot logging
    ///   - eventLoop: EventLoop to run this process on
    public func listMembersPaginator(
        _ input: ListMembersInput,
        logger: Logger = AWSClient.loggingDisabled,
        on eventLoop: EventLoop? = nil
    ) -> AWSClient.PaginatorSequence<ListMembersInput, ListMembersOutput> {
        return .init(
            input: input,
            command: self.listMembers,
            inputKey: \ListMembersInput.nextToken,
            outputKey: \ListMembersOutput.nextToken,
            logger: logger,
            on: eventLoop
        )
    }

    ///  Returns information about the networks in which the current Amazon Web Services account participates. Applies to Hyperledger Fabric and Ethereum.
    /// Return PaginatorSequence for operation.
    ///
    /// - Parameters:
    ///   - input: Input for request
    ///   - logger: Logger used flot logging
    ///   - eventLoop: EventLoop to run this process on
    public func listNetworksPaginator(
        _ input: ListNetworksInput,
        logger: Logger = AWSClient.loggingDisabled,
        on eventLoop: EventLoop? = nil
    ) -> AWSClient.PaginatorSequence<ListNetworksInput, ListNetworksOutput> {
        return .init(
            input: input,
            command: self.listNetworks,
            inputKey: \ListNetworksInput.nextToken,
            outputKey: \ListNetworksOutput.nextToken,
            logger: logger,
            on: eventLoop
        )
    }

    ///  Returns information about the nodes within a network. Applies to Hyperledger Fabric and Ethereum.
    /// Return PaginatorSequence for operation.
    ///
    /// - Parameters:
    ///   - input: Input for request
    ///   - logger: Logger used flot logging
    ///   - eventLoop: EventLoop to run this process on
    public func listNodesPaginator(
        _ input: ListNodesInput,
        logger: Logger = AWSClient.loggingDisabled,
        on eventLoop: EventLoop? = nil
    ) -> AWSClient.PaginatorSequence<ListNodesInput, ListNodesOutput> {
        return .init(
            input: input,
            command: self.listNodes,
            inputKey: \ListNodesInput.nextToken,
            outputKey: \ListNodesOutput.nextToken,
            logger: logger,
            on: eventLoop
        )
    }

    ///  Returns the list of votes for a specified proposal, including the value of each vote and the unique identifier of the member that cast the vote. Applies only to Hyperledger Fabric.
    /// Return PaginatorSequence for operation.
    ///
    /// - Parameters:
    ///   - input: Input for request
    ///   - logger: Logger used flot logging
    ///   - eventLoop: EventLoop to run this process on
    public func listProposalVotesPaginator(
        _ input: ListProposalVotesInput,
        logger: Logger = AWSClient.loggingDisabled,
        on eventLoop: EventLoop? = nil
    ) -> AWSClient.PaginatorSequence<ListProposalVotesInput, ListProposalVotesOutput> {
        return .init(
            input: input,
            command: self.listProposalVotes,
            inputKey: \ListProposalVotesInput.nextToken,
            outputKey: \ListProposalVotesOutput.nextToken,
            logger: logger,
            on: eventLoop
        )
    }

    ///  Returns a list of proposals for the network. Applies only to Hyperledger Fabric.
    /// Return PaginatorSequence for operation.
    ///
    /// - Parameters:
    ///   - input: Input for request
    ///   - logger: Logger used flot logging
    ///   - eventLoop: EventLoop to run this process on
    public func listProposalsPaginator(
        _ input: ListProposalsInput,
        logger: Logger = AWSClient.loggingDisabled,
        on eventLoop: EventLoop? = nil
    ) -> AWSClient.PaginatorSequence<ListProposalsInput, ListProposalsOutput> {
        return .init(
            input: input,
            command: self.listProposals,
            inputKey: \ListProposalsInput.nextToken,
            outputKey: \ListProposalsOutput.nextToken,
            logger: logger,
            on: eventLoop
        )
    }
}

#endif // compiler(>=5.5.2) && canImport(_Concurrency)
